<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>zunmbr.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="ZUNMBR.1"></a><a href="zunmbr.f.html#ZUNMBR.1">ZUNMBR</a>( VECT, SIDE, TRANS, M, N, K, A, LDA, TAU, C,
     $                   LDC, WORK, LWORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment">     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment">     November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      CHARACTER          SIDE, TRANS, VECT
      INTEGER            INFO, K, LDA, LDC, LWORK, M, N
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      COMPLEX*16         A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  If VECT = 'Q', <a name="ZUNMBR.19"></a><a href="zunmbr.f.html#ZUNMBR.1">ZUNMBR</a> overwrites the general complex M-by-N matrix C
</span><span class="comment">*</span><span class="comment">  with
</span><span class="comment">*</span><span class="comment">                  SIDE = 'L'     SIDE = 'R'
</span><span class="comment">*</span><span class="comment">  TRANS = 'N':      Q * C          C * Q
</span><span class="comment">*</span><span class="comment">  TRANS = 'C':      Q**H * C       C * Q**H
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  If VECT = 'P', <a name="ZUNMBR.25"></a><a href="zunmbr.f.html#ZUNMBR.1">ZUNMBR</a> overwrites the general complex M-by-N matrix C
</span><span class="comment">*</span><span class="comment">  with
</span><span class="comment">*</span><span class="comment">                  SIDE = 'L'     SIDE = 'R'
</span><span class="comment">*</span><span class="comment">  TRANS = 'N':      P * C          C * P
</span><span class="comment">*</span><span class="comment">  TRANS = 'C':      P**H * C       C * P**H
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Here Q and P**H are the unitary matrices determined by <a name="ZGEBRD.31"></a><a href="zgebrd.f.html#ZGEBRD.1">ZGEBRD</a> when
</span><span class="comment">*</span><span class="comment">  reducing a complex matrix A to bidiagonal form: A = Q * B * P**H. Q
</span><span class="comment">*</span><span class="comment">  and P**H are defined as products of elementary reflectors H(i) and
</span><span class="comment">*</span><span class="comment">  G(i) respectively.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Let nq = m if SIDE = 'L' and nq = n if SIDE = 'R'. Thus nq is the
</span><span class="comment">*</span><span class="comment">  order of the unitary matrix Q or P**H that is applied.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  If VECT = 'Q', A is assumed to have been an NQ-by-K matrix:
</span><span class="comment">*</span><span class="comment">  if nq &gt;= k, Q = H(1) H(2) . . . H(k);
</span><span class="comment">*</span><span class="comment">  if nq &lt; k, Q = H(1) H(2) . . . H(nq-1).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  If VECT = 'P', A is assumed to have been a K-by-NQ matrix:
</span><span class="comment">*</span><span class="comment">  if k &lt; nq, P = G(1) G(2) . . . G(k);
</span><span class="comment">*</span><span class="comment">  if k &gt;= nq, P = G(1) G(2) . . . G(nq-1).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  VECT    (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          = 'Q': apply Q or Q**H;
</span><span class="comment">*</span><span class="comment">          = 'P': apply P or P**H.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  SIDE    (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          = 'L': apply Q, Q**H, P or P**H from the Left;
</span><span class="comment">*</span><span class="comment">          = 'R': apply Q, Q**H, P or P**H from the Right.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  TRANS   (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          = 'N':  No transpose, apply Q or P;
</span><span class="comment">*</span><span class="comment">          = 'C':  Conjugate transpose, apply Q**H or P**H.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  M       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of rows of the matrix C. M &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of columns of the matrix C. N &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  K       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          If VECT = 'Q', the number of columns in the original
</span><span class="comment">*</span><span class="comment">          matrix reduced by <a name="ZGEBRD.70"></a><a href="zgebrd.f.html#ZGEBRD.1">ZGEBRD</a>.
</span><span class="comment">*</span><span class="comment">          If VECT = 'P', the number of rows in the original
</span><span class="comment">*</span><span class="comment">          matrix reduced by <a name="ZGEBRD.72"></a><a href="zgebrd.f.html#ZGEBRD.1">ZGEBRD</a>.
</span><span class="comment">*</span><span class="comment">          K &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  A       (input) COMPLEX*16 array, dimension
</span><span class="comment">*</span><span class="comment">                                (LDA,min(nq,K)) if VECT = 'Q'
</span><span class="comment">*</span><span class="comment">                                (LDA,nq)        if VECT = 'P'
</span><span class="comment">*</span><span class="comment">          The vectors which define the elementary reflectors H(i) and
</span><span class="comment">*</span><span class="comment">          G(i), whose products determine the matrices Q and P, as
</span><span class="comment">*</span><span class="comment">          returned by <a name="ZGEBRD.80"></a><a href="zgebrd.f.html#ZGEBRD.1">ZGEBRD</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDA     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array A.
</span><span class="comment">*</span><span class="comment">          If VECT = 'Q', LDA &gt;= max(1,nq);
</span><span class="comment">*</span><span class="comment">          if VECT = 'P', LDA &gt;= max(1,min(nq,K)).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  TAU     (input) COMPLEX*16 array, dimension (min(nq,K))
</span><span class="comment">*</span><span class="comment">          TAU(i) must contain the scalar factor of the elementary
</span><span class="comment">*</span><span class="comment">          reflector H(i) or G(i) which determines Q or P, as returned
</span><span class="comment">*</span><span class="comment">          by <a name="ZGEBRD.90"></a><a href="zgebrd.f.html#ZGEBRD.1">ZGEBRD</a> in the array argument TAUQ or TAUP.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  C       (input/output) COMPLEX*16 array, dimension (LDC,N)
</span><span class="comment">*</span><span class="comment">          On entry, the M-by-N matrix C.
</span><span class="comment">*</span><span class="comment">          On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q
</span><span class="comment">*</span><span class="comment">          or P*C or P**H*C or C*P or C*P**H.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDC     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array C. LDC &gt;= max(1,M).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK    (workspace/output) COMPLEX*16 array, dimension (MAX(1,LWORK))
</span><span class="comment">*</span><span class="comment">          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LWORK   (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The dimension of the array WORK.
</span><span class="comment">*</span><span class="comment">          If SIDE = 'L', LWORK &gt;= max(1,N);
</span><span class="comment">*</span><span class="comment">          if SIDE = 'R', LWORK &gt;= max(1,M);
</span><span class="comment">*</span><span class="comment">          if N = 0 or M = 0, LWORK &gt;= 1.
</span><span class="comment">*</span><span class="comment">          For optimum performance LWORK &gt;= max(1,N*NB) if SIDE = 'L',
</span><span class="comment">*</span><span class="comment">          and LWORK &gt;= max(1,M*NB) if SIDE = 'R', where NB is the
</span><span class="comment">*</span><span class="comment">          optimal blocksize. (NB = 0 if M = 0 or N = 0.)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">          If LWORK = -1, then a workspace query is assumed; the routine
</span><span class="comment">*</span><span class="comment">          only calculates the optimal size of the WORK array, returns
</span><span class="comment">*</span><span class="comment">          this value as the first entry of the WORK array, and no error
</span><span class="comment">*</span><span class="comment">          message related to LWORK is issued by <a name="XERBLA.115"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INFO    (output) INTEGER
</span><span class="comment">*</span><span class="comment">          = 0:  successful exit
</span><span class="comment">*</span><span class="comment">          &lt; 0:  if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      LOGICAL            APPLYQ, LEFT, LQUERY, NOTRAN
      CHARACTER          TRANST
      INTEGER            I1, I2, IINFO, LWKOPT, MI, NB, NI, NQ, NW
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL            <a name="LSAME.129"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      INTEGER            <a name="ILAENV.130"></a><a href="ilaenv.f.html#ILAENV.1">ILAENV</a>
      EXTERNAL           <a name="LSAME.131"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="ILAENV.131"></a><a href="ilaenv.f.html#ILAENV.1">ILAENV</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="XERBLA.134"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, <a name="ZUNMLQ.134"></a><a href="zunmlq.f.html#ZUNMLQ.1">ZUNMLQ</a>, <a name="ZUNMQR.134"></a><a href="zunmqr.f.html#ZUNMQR.1">ZUNMQR</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          MAX, MIN
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input arguments
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      APPLYQ = <a name="LSAME.144"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'Q'</span> )
      LEFT = <a name="LSAME.145"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SIDE, <span class="string">'L'</span> )
      NOTRAN = <a name="LSAME.146"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'N'</span> )
      LQUERY = ( LWORK.EQ.-1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     NQ is the order of Q or P and NW is the minimum dimension of WORK
</span><span class="comment">*</span><span class="comment">
</span>      IF( LEFT ) THEN
         NQ = M
         NW = N
      ELSE
         NQ = N
         NW = M
      END IF
      IF( M.EQ.0 .OR. N.EQ.0 ) THEN
         NW = 0
      END IF
      IF( .NOT.APPLYQ .AND. .NOT.<a name="LSAME.161"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'P'</span> ) ) THEN
         INFO = -1
      ELSE IF( .NOT.LEFT .AND. .NOT.<a name="LSAME.163"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SIDE, <span class="string">'R'</span> ) ) THEN
         INFO = -2
      ELSE IF( .NOT.NOTRAN .AND. .NOT.<a name="LSAME.165"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'C'</span> ) ) THEN
         INFO = -3
      ELSE IF( M.LT.0 ) THEN
         INFO = -4
      ELSE IF( N.LT.0 ) THEN
         INFO = -5
      ELSE IF( K.LT.0 ) THEN
         INFO = -6
      ELSE IF( ( APPLYQ .AND. LDA.LT.MAX( 1, NQ ) ) .OR.
     $         ( .NOT.APPLYQ .AND. LDA.LT.MAX( 1, MIN( NQ, K ) ) ) )
     $          THEN
         INFO = -8
      ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
         INFO = -11
      ELSE IF( LWORK.LT.MAX( 1, NW ) .AND. .NOT.LQUERY ) THEN
         INFO = -13
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( INFO.EQ.0 ) THEN
         IF( NW.GT.0 ) THEN
            IF( APPLYQ ) THEN
               IF( LEFT ) THEN
                  NB = <a name="ILAENV.187"></a><a href="ilaenv.f.html#ILAENV.1">ILAENV</a>( 1, <span class="string">'<a name="ZUNMQR.187"></a><a href="zunmqr.f.html#ZUNMQR.1">ZUNMQR</a>'</span>, SIDE // TRANS, M-1, N, M-1,
     $                 -1 )
               ELSE
                  NB = <a name="ILAENV.190"></a><a href="ilaenv.f.html#ILAENV.1">ILAENV</a>( 1, <span class="string">'<a name="ZUNMQR.190"></a><a href="zunmqr.f.html#ZUNMQR.1">ZUNMQR</a>'</span>, SIDE // TRANS, M, N-1, N-1,
     $                 -1 )
               END IF
            ELSE
               IF( LEFT ) THEN
                  NB = <a name="ILAENV.195"></a><a href="ilaenv.f.html#ILAENV.1">ILAENV</a>( 1, <span class="string">'<a name="ZUNMLQ.195"></a><a href="zunmlq.f.html#ZUNMLQ.1">ZUNMLQ</a>'</span>, SIDE // TRANS, M-1, N, M-1,
     $                 -1 )
               ELSE
                  NB = <a name="ILAENV.198"></a><a href="ilaenv.f.html#ILAENV.1">ILAENV</a>( 1, <span class="string">'<a name="ZUNMLQ.198"></a><a href="zunmlq.f.html#ZUNMLQ.1">ZUNMLQ</a>'</span>, SIDE // TRANS, M, N-1, N-1,
     $                 -1 )
               END IF
            END IF
            LWKOPT = MAX( 1, NW*NB )
         ELSE
            LWKOPT = 1
         END IF
         WORK( 1 ) = LWKOPT
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.210"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZUNMBR.210"></a><a href="zunmbr.f.html#ZUNMBR.1">ZUNMBR</a>'</span>, -INFO )
         RETURN
      ELSE IF( LQUERY ) THEN
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span>      IF( M.EQ.0 .OR. N.EQ.0 )
     $   RETURN
<span class="comment">*</span><span class="comment">
</span>      IF( APPLYQ ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Apply Q
</span><span class="comment">*</span><span class="comment">
</span>         IF( NQ.GE.K ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Q was determined by a call to <a name="ZGEBRD.227"></a><a href="zgebrd.f.html#ZGEBRD.1">ZGEBRD</a> with nq &gt;= k
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="ZUNMQR.229"></a><a href="zunmqr.f.html#ZUNMQR.1">ZUNMQR</a>( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC,
     $                   WORK, LWORK, IINFO )
         ELSE IF( NQ.GT.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Q was determined by a call to <a name="ZGEBRD.233"></a><a href="zgebrd.f.html#ZGEBRD.1">ZGEBRD</a> with nq &lt; k
</span><span class="comment">*</span><span class="comment">
</span>            IF( LEFT ) THEN
               MI = M - 1
               NI = N
               I1 = 2
               I2 = 1
            ELSE
               MI = M
               NI = N - 1
               I1 = 1
               I2 = 2
            END IF
            CALL <a name="ZUNMQR.246"></a><a href="zunmqr.f.html#ZUNMQR.1">ZUNMQR</a>( SIDE, TRANS, MI, NI, NQ-1, A( 2, 1 ), LDA, TAU,
     $                   C( I1, I2 ), LDC, WORK, LWORK, IINFO )
         END IF
      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Apply P
</span><span class="comment">*</span><span class="comment">
</span>         IF( NOTRAN ) THEN
            TRANST = <span class="string">'C'</span>
         ELSE
            TRANST = <span class="string">'N'</span>
         END IF
         IF( NQ.GT.K ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           P was determined by a call to <a name="ZGEBRD.260"></a><a href="zgebrd.f.html#ZGEBRD.1">ZGEBRD</a> with nq &gt; k
</span><span class="comment">*</span><span class="comment">
</span>            CALL <a name="ZUNMLQ.262"></a><a href="zunmlq.f.html#ZUNMLQ.1">ZUNMLQ</a>( SIDE, TRANST, M, N, K, A, LDA, TAU, C, LDC,
     $                   WORK, LWORK, IINFO )
         ELSE IF( NQ.GT.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           P was determined by a call to <a name="ZGEBRD.266"></a><a href="zgebrd.f.html#ZGEBRD.1">ZGEBRD</a> with nq &lt;= k
</span><span class="comment">*</span><span class="comment">
</span>            IF( LEFT ) THEN
               MI = M - 1
               NI = N
               I1 = 2
               I2 = 1
            ELSE
               MI = M
               NI = N - 1
               I1 = 1
               I2 = 2
            END IF
            CALL <a name="ZUNMLQ.279"></a><a href="zunmlq.f.html#ZUNMLQ.1">ZUNMLQ</a>( SIDE, TRANST, MI, NI, NQ-1, A( 1, 2 ), LDA,
     $                   TAU, C( I1, I2 ), LDC, WORK, LWORK, IINFO )
         END IF
      END IF
      WORK( 1 ) = LWKOPT
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="ZUNMBR.286"></a><a href="zunmbr.f.html#ZUNMBR.1">ZUNMBR</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
